import React from 'react';

import './index.less';

import {render} from '../../../../../hrpub/common/frame';

import {
    base
} from 'nc-lightapp-front';
import BatchAction from '../../actions/batchAdd';
import EntryInfo from './components/EntryInfo';
import SelectMan from './components/SelectMan';

const {
    NCModal,
    NCStep,
    NCButton
} = base;

const {
    Header,
    Body,
    Footer
} = NCModal;

const {NCSteps} = NCStep;


export default render({
    actions: {
        // batchAct: BatchAction
    },
    state: {
        selectAll: false,
        selectRows: null
    }
})(({props, state, action}) => {
    const {
        exam,
        form,
        search,
        editTable
    } = props;

    return (
        <NCModal
            show={exam.batchAddModalVisible}
            size="lg"
            onHide={props.batAddAct.closeBatchModal}
            className="batch-add-modal"
        >
            <Header
                closeButton={true}
            >
                {exam.json['gx6008-000057']/** 批量新增 */}
            </Header>
            <Body>
                <div className="batch-add-modal-step-wrapper">
                    <NCSteps
                        current={exam.batchAddCurrentStep}
                    >
                        <NCStep
                            title={exam.json['gx6008-000058']/** "选择人员" */}
                        />
                        <NCStep
                            title={exam.json['gx6008-000198'/** "转正信息" */]}
                        />
                    </NCSteps>
                </div>
                <If condition={exam.batchAddCurrentStep === 0}>
                    <SelectMan 
                        pk_org={exam.refValue ? exam.refValue.refpk : ''}
                        probationType = {exam.probationType === '3'?'':exam.probationType}
                        search={search}
                        json={exam.json}
                        editTable={editTable}
                        changePersonRefer={props.batAddAct.changePersonRefer}
                        selectedAll={props.batAddAct.selectedAll}
                        openBatchAddSearchModal={props.batAddAct.openBatchAddSearchModal}
                    />
                <Else/>
                    <EntryInfo 
                        form={form}
                        formBeforeEdit={props.formAct.formBeforeEdit}
                        formAfterEdit={props.formAct.formAfterEdit}
                    />
                </If>
                <div style={{
                    display: 'none'
                }}>
                    {props.search.NCCreateSearch('multiadd', {
                        clickSearchBtn: props.batAddAct.toSearchWrapper
                    })}
                </div>
            </Body>
            <Footer>
                <div className="batch-add-modal-footer">
                    <NCButton
                        disabled={exam.batchAddCurrentStep === 0}
                        onClick={props.batAddAct.goToPrevStep}
                    >
                        {exam.json['gx6008-000062']/** 上一步 */}
                    </NCButton>
                    <NCButton
                        disabled={exam.batchAddCurrentStep === 1}
                        onClick={props.batAddAct.goToNextStep}
                    >
                        {exam.json['gx6008-000063']/** 下一步 */}
                    </NCButton>
                    <NCButton
                        disabled={exam.batchAddCurrentStep === 0}
                        onClick={props.batAddAct.batchAddChack}
                    >
                        {exam.json['gx6008-000064']/** 完成 */}
                    </NCButton>
                    <NCButton
                        onClick={props.batAddAct.closeBatchModal}
                    >
                        {exam.json['gx6008-000025']/** 取消 */}
                    </NCButton>
                </div>
            </Footer>
        </NCModal>
    );

});